package ProjectMain;

/**
@Author: Ryan Carvalho
* @Author: Nathan Butler
* @Author Rhys Higa
* @Version: October 20, 2013
*/
public class iCalDate
   {
       private String month, day, year, hour, minute,time = " ";
       public iCalDate()
       {
    	   //default
       }
       public iCalDate(String y, String mon, String d, String h, String min)
       {
    	   month = mon;
           day = d;
           year = y;
           hour = h;
           minute = min;
       }
     //for classes
       public iCalDate(String y, String mon, String d, String t)
       {
    	   month = mon;
    	   day = d;
    	   year = y;
    	   time = t;
       }
       public String getMonth()
       {
       	return month;
       }
       public String getDay()
       {
       	return day;
       }
       public String getYear()
       {
       	return year;
       }
       public String getHour()
       {
       	return hour;
       }
       public String getMin()
       {
       	return minute;
       }
       public String getTime()
       {
    	   return time;
       }
       public int compareTo(iCalDate e)
       {
       	if(Integer.parseInt(e.getYear()) < 
                     Integer.parseInt(this.getYear()))
           {
       		return -1;
           }
           else if(Integer.parseInt(e.getMonth()) < 
                     Integer.parseInt(this.getMonth()))
           {
           	return -1;
           }
           else if(Integer.parseInt(e.getDay())
                      < Integer.parseInt(this.getDay()))
           {
           	return -1;
           }
           else if(Integer.parseInt(e.getHour()) < 
                      Integer.parseInt(this.getHour()))
           {
           	return -1;
           }
           /**
             * if statement to catch if ending minute was before starting minute
             * 00 is the exception because if the ending hour is greater than
             * the starting hour, the minutes can be 00. But otherwise the ending
             * minutes need to be > the starting minutes.
             */
           else if(Integer.parseInt(e.getHour())
                      > Integer.parseInt(this.getHour()))
           {
           	if(Integer.parseInt(e.getMin()) == 0 || Integer.parseInt(e.getMin()) == 
                       Integer.parseInt(this.getMin()))
               {
           		return 1;
               }
               else
               {
               	return -1;
               }
           }
           else
           {
           	return 1;
           }
       }
   }
   
    